#!/usr/bin/env python

import os

class FileError(OSError):
    def __init__(self,name,OSErr):
        OSError.__init__(self,OSErr)
        self.name = name
        self.errno = OSErr.errno
        self.strerror = OSErr.strerror
    def __str__(self):
        return "File error({0}): {1}: {2}.".format(self.errno,self.name,self.strerror)
    def __call__(self) :
        return (self.errno,self.strerror)

class DirList:
    def __init__(self,name):
        self.name = name
        self.FList = []
        self.DList = []
        self.MP3List = []
        try:
            for file in os.listdir(name):
                path = name + '/' + file
                if os.path.isdir(path):
                    self.DList.append(file)
                elif os.path.isfile(path):
                    self.FList.append(file)
        except OSError as Ex:
            raise FileError(self.name,Ex)
                
    def Files(self):
        return self.FList
    def MP3Files(self):
        return self.MP3List
    def Dirs(self):
        return self.DList

class FileInfo:
    def __init__(self,name):
        self.name = name

class MP3File:
    def __init__(self,name):
        self.name = name

if __name__ == '__main__':
    DL = DirList('.')
    print 'Files:'
    for file in DL.Files():
        print file
